import type { IUserInfo } from '@/interface/ILogin'
import { defineStore } from 'pinia'
import { ref, type Ref } from 'vue'
// 默认初始值  带有token
const origin: IUserInfo = {
  token:'',
  routes: [],
  uname: "",
  userid: "",
  avatar: ""
}
export const usePeopleStore = defineStore('people', () => {
    const userInfo: Ref<IUserInfo> = ref({...origin})
    const clearUserInfo=()=>{
    userInfo.value={...origin};
  }
  return { userInfo,clearUserInfo }
}, {
  persist: {
    storage: localStorage,
    key: "people"
  }
})
